package com.qf.mapper;


import com.qf.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("select * from t_users where id=#{xxxx}")
    public User findUserById(@Param("xxxx") Integer id);

    @Select("select * from t_users")
    public List<User> findUserAll();

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("INSERT INTO t_users (name, password, sex, birthday, registTime) \" +\n" +
            " values(#{user.userName},#{user.password},#{user.sex},#{user.birthday},#{user.registTime})")
    public void insertUser(@Param("user")User user);

    public void updateUser(User user);

    @Delete("delete from t_users where id=#{id}")
    public void deleteUser(@Param("id") Integer id);

    public List<User> findUserByName(String name);

    public List<User> findUserAndDesc();

    public List<User> findUserAndOrder();

    public List<User> findUserAndOrderAndProduct();


    public List<User> findUserByNameAndSex(User user);

    public List<User> findUserByIds(@Param("ids") List<Integer> ids);

    public List<User> findUserByNameAndSex2(@Param("user") User user);

    //分页
    public List<User> findUserByPage();
}
